package com.samsung.list;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore.Images;
import android.widget.ImageView;

import com.samsung.R;

public class ViewPictureActivity extends Activity
{
	
	private ImageView picture;
	private String filepath;

	@Override
	protected void onCreate(Bundle savedInstanceState)
	{
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		
		setContentView(R.layout.mypicture);
		
		picture = (ImageView) findViewById(R.id.picture);
		
		Intent intent = getIntent();
		
		filepath = intent.getStringExtra("filepath");
		
		File file = new File(filepath);
		
		Uri uri = Uri.fromFile(file);
		
		picture.setImageURI(uri);
		
		Bitmap bm = null;
		try
		{
			bm = Images.Media.getBitmap(getContentResolver(), uri);
		}
		catch (FileNotFoundException e)
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		catch (IOException e)
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		picture.setImageBitmap(bm);
		
	}

}
